package com.yc.cloud.admin.dto.response;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 人脸识别服务通用响应基类
 * 所有人脸识别服务的响应都遵循此格式
 *
 * @param <T> 响应数据类型
 * @author JackGu
 * @since 2025-11-05
 */
@Data
@ApiModel(value = "人脸识别服务通用响应")
public class BaseFaceResponse<T> {

    @ApiModelProperty(value = "状态码（200表示成功）")
    private Integer code;

    @ApiModelProperty(value = "是否成功")
    private Boolean success;

    @ApiModelProperty(value = "响应消息")
    private String msg;

    @ApiModelProperty(value = "响应数据")
    private T data;

    @ApiModelProperty(value = "时间戳")
    private String timestamp;

    /**
     * 判断请求是否成功
     */
    public boolean isSuccess() {
        return Boolean.TRUE.equals(success) && code != null && code == 200;
    }
}

